import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primaryColor: Colors.red),
      home: Scaffold(
        appBar: AppBar(title: const Text('Flutter app')),
        body: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    /**
     * Stack ： 是一个布局组件，用于将多个子组件堆叠在一起
     * 允许你将子组件按照顺序层层叠放，后面的组件会覆盖前面的组件。
     */
    return Stack(
      alignment: Alignment.center,
      children: [
        Container(
          height: 400,
          width: 400,
          color: Colors.red,
        ),
        Container(
          height: 400,
          width: 400,
          color: Colors.yellow,
        ),
        const Text('你好，Flutter！')
      ],
    );
  }
}
